package com.raven.craft.code.generator.mysql.repo.entity;

import lombok.*;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author raven
 * @date 2019-03-30 21:08
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class Table {

    private String name;
    private List<Column> columns;
    private TableStatus status;

    public Set<String> getColumnJavaTypes() {
        return this.getColumns().stream()
                .map(column -> column.getJavaType().getType().getName())
                .filter(type -> !type.startsWith("java.lang"))
                .collect(Collectors.toSet());
    }
}
